﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using SvD_Templates;

namespace WindowsFormsApplication1
{
    public partial class SeverityQuestions : Form
    {
        public datosTemplate _dt;

        #region Borderless Window
        protected override void WndProc(ref Message m)
        {
            // Let the base class have first crack
            base.WndProc(ref m);
            int WM_NCHITTEST = 0x84; // winuser.h
            // If the user clicked on the client area,
            // ask the OS to treat it as a click on the caption
            if (m.Msg != WM_NCHITTEST) return;
            int HTCLIENT = 1;
            int HTCAPTION = 2;
            if (m.Result.ToInt32() == HTCLIENT)
                m.Result = (IntPtr)HTCAPTION;
        }
        #endregion

        #region Function Keys
        protected override bool ProcessDialogKey(Keys keyData)
        {
            switch (keyData)
            {
                case Keys.Escape:
                    this.saveInformation();
                    this.Close();
                    break;
            }

            return base.ProcessDialogKey(keyData);
        }
        #endregion

        public SeverityQuestions()
        {
            InitializeComponent();
        }

        private void SeverityQuestions_Load(object sender, EventArgs e)
        {
            cajaShipments1.Text = _dt.SQ_Shipments_1;
            cajaShipments2.Text = _dt.SQ_Shipments_2;
            cajaShipments3.Text = _dt.SQ_Shipments_3;

            cajaManufacturing1.Text = _dt.SQ_Manufacturing_1;
            cajaManufacturing2.Text = _dt.SQ_Manufacturing_2;
            cajaManufacturing3.Text = _dt.SQ_Manufacturing_3;

            cajaBusiness1.Text = _dt.SQ_Business_1;
            cajaBusiness2.Text = _dt.SQ_Business_2;
            cajaBusiness3.Text = _dt.SQ_Business_3;

            cajaOutage1.Text = _dt.SQ_Outage_1;
            cajaOutage2.Text = _dt.SQ_Outage_2;
            cajaOutage3.Text = _dt.SQ_Outage_3;

            cajaOther1.Text = _dt.SQ_Other_1;
            cajaOther2.Text = _dt.SQ_Other_2;
            cajaOther3.Text = _dt.SQ_Other_3;
        }

        private void saveInformation()
        {
            _dt.SQ_Shipments_1 = cajaShipments1.Text;
            _dt.SQ_Shipments_2 = cajaShipments2.Text;
            _dt.SQ_Shipments_3 = cajaShipments3.Text;

            _dt.SQ_Manufacturing_1 = cajaManufacturing1.Text;
            _dt.SQ_Manufacturing_2 = cajaManufacturing2.Text;
            _dt.SQ_Manufacturing_3 = cajaManufacturing3.Text;

            _dt.SQ_Business_1 = cajaBusiness1.Text;
            _dt.SQ_Business_2 = cajaBusiness2.Text;
            _dt.SQ_Business_3 = cajaBusiness3.Text;

            _dt.SQ_Outage_1 = cajaOutage1.Text;
            _dt.SQ_Outage_2 = cajaOutage2.Text;
            _dt.SQ_Outage_3 = cajaOutage3.Text;

            _dt.SQ_Other_1 = cajaOther1.Text;
            _dt.SQ_Other_2 = cajaOther2.Text;
            _dt.SQ_Other_3 = cajaOther3.Text;
        }
    }
}
